/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ms.jasim.model.items.util;

import java.util.List;

import ms.jasim.model.ModelObject;
import ms.jasim.model.NamedModelObject;
import ms.jasim.model.items.*;
import ms.jasim.model.items.ActorItem;
import ms.jasim.model.items.GoalItem;
import ms.jasim.model.items.IntItem;
import ms.jasim.model.items.Item;
import ms.jasim.model.items.ItemList;
import ms.jasim.model.items.ItemsPackage;
import ms.jasim.model.items.TextItem;
import ms.utils.IModelObjectList;
import ms.utils.INamedItem;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see ms.jasim.model.items.ItemsPackage
 * @generated
 */
public class ItemsSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static ItemsPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ItemsSwitch() {
		if (modelPackage == null) {
			modelPackage = ItemsPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case ItemsPackage.ITEM_LIST: {
				ItemList itemList = (ItemList)theEObject;
				T result = caseItemList(itemList);
				if (result == null) result = caseIItemList(itemList);
				if (result == null) result = caseItem(itemList);
				if (result == null) result = caseNamedModelObject(itemList);
				if (result == null) result = caseModelObject(itemList);
				if (result == null) result = caseINamedItem(itemList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.ITEM: {
				Item item = (Item)theEObject;
				T result = caseItem(item);
				if (result == null) result = caseNamedModelObject(item);
				if (result == null) result = caseModelObject(item);
				if (result == null) result = caseINamedItem(item);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.TEXT_ITEM: {
				TextItem textItem = (TextItem)theEObject;
				T result = caseTextItem(textItem);
				if (result == null) result = caseItem(textItem);
				if (result == null) result = caseNamedModelObject(textItem);
				if (result == null) result = caseModelObject(textItem);
				if (result == null) result = caseINamedItem(textItem);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.INT_ITEM: {
				IntItem intItem = (IntItem)theEObject;
				T result = caseIntItem(intItem);
				if (result == null) result = caseItem(intItem);
				if (result == null) result = caseNamedModelObject(intItem);
				if (result == null) result = caseModelObject(intItem);
				if (result == null) result = caseINamedItem(intItem);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.GOAL_ITEM: {
				GoalItem goalItem = (GoalItem)theEObject;
				T result = caseGoalItem(goalItem);
				if (result == null) result = caseItem(goalItem);
				if (result == null) result = caseNamedModelObject(goalItem);
				if (result == null) result = caseModelObject(goalItem);
				if (result == null) result = caseINamedItem(goalItem);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.ACTOR_ITEM: {
				ActorItem actorItem = (ActorItem)theEObject;
				T result = caseActorItem(actorItem);
				if (result == null) result = caseItem(actorItem);
				if (result == null) result = caseNamedModelObject(actorItem);
				if (result == null) result = caseModelObject(actorItem);
				if (result == null) result = caseINamedItem(actorItem);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.GOAL_LIST_ITEM: {
				GoalListItem goalListItem = (GoalListItem)theEObject;
				T result = caseGoalListItem(goalListItem);
				if (result == null) result = caseItem(goalListItem);
				if (result == null) result = caseNamedModelObject(goalListItem);
				if (result == null) result = caseModelObject(goalListItem);
				if (result == null) result = caseINamedItem(goalListItem);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.ACTOR_LIST_ITEM: {
				ActorListItem actorListItem = (ActorListItem)theEObject;
				T result = caseActorListItem(actorListItem);
				if (result == null) result = caseItem(actorListItem);
				if (result == null) result = caseNamedModelObject(actorListItem);
				if (result == null) result = caseModelObject(actorListItem);
				if (result == null) result = caseINamedItem(actorListItem);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.PROPERTY_LIST: {
				PropertyList propertyList = (PropertyList)theEObject;
				T result = casePropertyList(propertyList);
				if (result == null) result = caseItemList(propertyList);
				if (result == null) result = caseIItemList(propertyList);
				if (result == null) result = caseItem(propertyList);
				if (result == null) result = caseNamedModelObject(propertyList);
				if (result == null) result = caseModelObject(propertyList);
				if (result == null) result = caseINamedItem(propertyList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.OBJECT_PROPERTY: {
				ObjectProperty objectProperty = (ObjectProperty)theEObject;
				T result = caseObjectProperty(objectProperty);
				if (result == null) result = caseModelObject(objectProperty);
				if (result == null) result = caseINamedItem(objectProperty);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.OBJECT_PROPERTY_LIST: {
				ObjectPropertyList objectPropertyList = (ObjectPropertyList)theEObject;
				T result = caseObjectPropertyList(objectPropertyList);
				if (result == null) result = caseIObjectPropertyList(objectPropertyList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.PROPERTY_DESCRIPTOR: {
				PropertyDescriptor propertyDescriptor = (PropertyDescriptor)theEObject;
				T result = casePropertyDescriptor(propertyDescriptor);
				if (result == null) result = caseNamedModelObject(propertyDescriptor);
				if (result == null) result = caseModelObject(propertyDescriptor);
				if (result == null) result = caseINamedItem(propertyDescriptor);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ItemsPackage.PROPERTY_DESCRIPTOR_LIST: {
				PropertyDescriptorList propertyDescriptorList = (PropertyDescriptorList)theEObject;
				T result = casePropertyDescriptorList(propertyDescriptorList);
				if (result == null) result = caseIPropertyDescriptorList(propertyDescriptorList);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Item List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Item List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseItemList(ItemList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseItem(Item object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Text Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Text Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTextItem(TextItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Int Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Int Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIntItem(IntItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Goal Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Goal Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseGoalItem(GoalItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Actor Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Actor Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseActorItem(ActorItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Goal List Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Goal List Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseGoalListItem(GoalListItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Actor List Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Actor List Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseActorListItem(ActorListItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Property List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Property List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T casePropertyList(PropertyList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Object Property</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Object Property</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseObjectProperty(ObjectProperty object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Object Property List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Object Property List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseObjectPropertyList(ObjectPropertyList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IObject Property List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IObject Property List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIObjectPropertyList(IModelObjectList<ObjectProperty> object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Property Descriptor</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Property Descriptor</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T casePropertyDescriptor(PropertyDescriptor object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Property Descriptor List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Property Descriptor List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T casePropertyDescriptorList(PropertyDescriptorList object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IProperty Descriptor List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IProperty Descriptor List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIPropertyDescriptorList(IModelObjectList<PropertyDescriptor> object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>IItem List</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>IItem List</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIItemList(IModelObjectList<Item> object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseModelObject(ModelObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>INamed Item</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>INamed Item</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseINamedItem(INamedItem object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Named Model Object</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Named Model Object</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseNamedModelObject(NamedModelObject object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //ItemsSwitch
